<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="/public/public_css::public_css ('收货任务')" />

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-input-inline">供应商名称</label>
                        <input type="text" class="layui-input" name="gysmc" id="gysmc" placeholder="请输入供应商名称" />

                    </div>
                    <div class="layui-inline">
                        <label class="layui-input-inline">PO编号</label>
                        <input type="text" class="layui-input" name="dycgdbh" id="dycgdbh" placeholder="请输入PO编号" />
                    </div>
                    <div class="layui-inline">
                        <label class="layui-input-inline">ASN编号</label>
                        <input type="text" class="layui-input" name="asnbh" id="asnbh" placeholder="请输入ASN编号" />
                    </div>
                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal search_btn" lay-event="searchEvent" data-type="reload">查询</a>
                    </div>
                    <div class="layui-inline inline-reset-btn">
                        <button type="reset" class="layui-btn layui-btn-primary" style="background-color: #40AFFE">重置</button>
                    </div>
                    <div class="moreSearch" style="display: none">
                        <div class="layui-inline">
                            <label class="layui-input-inline">创建时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="cjsj" name="cjsj" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-input-inline">ASN状态</label>
                            <select id="asnzt" name="asnzt" class="selector" lay-filter="aihao">
                                <option value="" >全部</option>
                                <option value="0">创建</option>
                                <option value="1">部分收货</option>
                                <option value="2">完全收货</option>
                                <option value="3">订单取消</option>
                                <option value="4">ASN完成</option>
                            </select>
                        </div>
                    </div>
                    <input type="hidden" id="cjsj_start" name="cjsj_start">
                    <input type="hidden" id="cjsj_end" name="cjsj_end">
                    <div class="moreBtn"><i class="layui-icon layui-icon-triangle-d" style="color: #1E9FFF;"></i></div>
                </form>
            <!--顶部按钮展示区域 【 tpl-button 】 -->
            <div class="group-button tpl-button" id="toolbar"></div>
            <!--列表-->
            <section class="panel panel-padding layui-card-body">
                <div class="pro">
                    <table id="table" class="table text-nowrap"></table>
                </div>
            </section>
        </div>
    </div>
    </div>
</div>

</body>


<div th:include="/public/public_js::public_js"></div>
<div th:include="/public/public_btn::public_btn"></div>
<style type="text/css">
    .moreBtn{
        width:50px;
        height:20px;
        text-align:center;
        color:#fff;
        line-height:20px;
        background-color:#eee;
        position:relative;
        margin: 0 auto;
        cursor: pointer;
    }
    .moreBtn:before{
        content:'';
        display:block;
        width:35px;
        height:20px;
        position:absolute;
        transform:skewX(30deg);
        background:#eee;
        border-top-left-radius:8px;
        left:-20px;
        top:0;
    }
    .moreBtn:after{
        content:'';
        display:block;
        width:35px;
        height:20px;
        position:absolute;
        transform:skewX(-30deg);
        background:#eee;
        border-top-right-radius:8px;
        top:0;
        right:-20px;
    }
</style>
<script th:inline="javascript">
    $(function () {
        $(".moreBtn").on("click",function () {
            $(".moreSearch").toggle();
        })
    });
    var functions = [[${functions}]];
    layui.use(['list', 'layer', 'zzpUtils', 'jquery', 'laydate', 'tablebutton'], function () {
        var zzpUtils= layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate,
            tablebtn = layui.tablebutton;
        tablebtn.buildOnClick({
            type: 1,
            temp: $("#function_tpl"),
            functions: functions.headBtn,
            row: null,
            event: {
                searchEvent: function(){
                    zzpUtils.refreshTable("#table");
                },
                /*生成*/
                generateEvent: function (data) {
                    generateDialog(data);
                },
            }
        });
        //初始化
        zzpUtils.webSocket.init();
        laydate.render({
            elem: '#cjsj',
            type: 'date',
            range: '~',
            done: function(value, date, endDate){
                if(value!=null && value!=""){
                    var start=value.toString().substring(0,value.toString().indexOf("~"));
                    var end=value.toString().substring(value.toString().indexOf("~")+1);
                    $("#cjsj_start").val(Date.parse(new Date(start)));
                    $("#cjsj_end").val(Date.parse(new Date(end)));
                }else {
                    $("#cjsj_start").val("");
                    $("#cjsj_end").val("");
                }

                console.log(value); //得到日期生成的值，如：2017-08-18
                console.log(date); //得到日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
                console.log(endDate); //得结束的日期时间对象，开启范围选择（range: true）才会返回。对象成员同上。
            }
        });
        //生成
        function generateDialog(data){
            var id=data.row.id;
            var asnbh=data.row.asnbh;
            var gysmc=data.row.gysmc;
            var mpzt=data.row.mpzt;
            var yxj=data.row.yxj;
            var zzpUtils = layui.zzpUtils,
                $ = layui.jquery,
                laydate = layui.laydate;
            zzpUtils.dialog({
                title: "查看收货任务人员",
                type: 2,
                content: "/FEzxwms/createrRceivingTask?id=" + id+"&asnbh="+asnbh+"&gysmc="+gysmc+"&mpzt="+mpzt+"&yxj="+yxj,
                area: ['35%', '60%'], //设置dialog大小，也可以不设置，
                end: function () {//增加成功后刷新
                    zzpUtils.refreshTable("#table");
                }
            });
        }
        laydate.render({
            elem: '#test5'
            ,theme: '#20a0ff'
        })
        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            isOperate: true,
            pagination: true,
            url: '/wmsEstimatedArrivalOrder/list',
            columns: [{
                field: '',
                checkbox: true
            }, {
                field: 'ckmc',
                title: '仓库'
            },{
                field: 'hzmc',
                title: '货主'
            },{
                field: 'asnbh',
                title: 'ASN编号'
            },{
                field: 'show_asnlx',
                title: 'ASN类型'
            },{
                field: 'show_asnzt',
                title: 'ASN状态'
            },{
                field: 'show_yxj',
                title: '优先级',
            },{
                field: 'yjdhsjks',
                title: '预计到货时间'
            },{
                field: 'cjsj',
                title: '创建时间'
            },{
                field: 'show_shzt',
                title: '审核状态'
            },{
                field: 'dycgdbh',
                title: '关联PO编号'
            },{
                field: 'zdr',
                title: '制单人'
            },{
                field: 'ddshr',
                title: '审核人'
            },{
                field: 'show_mpzt',
                title: '码盘状态'
            },{
                field: 'shwcsj',
                title: '收货完成时间'
            },{
                field: 'show_dyzt',
                title: '打印状态'
            },{
                field: 'dysj',
                title: '打印时间'
            },{
                field: 'gysmc',
                title: '供应商'
            }],
            queryParams: function () {//查询条件
                return  zzpUtils.getFormJson($("#searchForm"));
            },
            detailFormatter: function (index, row) {
                return "这里就没有确定过11";
            },
            /*定义表格右侧按钮*/
            operateFormatter: operateFormatter
        });
        /*表格右侧按钮*/
        function operateFormatter(value, row, index) {
            if (row.asnzt == '0'&&row.shzt == '1'&&row.sczt == '0') {
                var button = '<a class="tooltip2" id="tooltip' + row.id + '" data-tooltip-content="#tool' + row.id + '" id="btn_start"><i class="layui-icon layui-icon-more"></i></a>'
                    + '<div class="tooltip_templates">'
                    + '<span id="tool' + row.id + '">';
                for (var i = 0; i < functions.tableBtn.length; i++) {
                    var btn = '<a class="layui-btn layui-btn-sm layui-btn-warm" lay-event="' + functions.tableBtn[i].event + '">'
                        + functions.tableBtn[i].name
                        + '</a>';
                    button += btn;
                }
                button += '</span>'
                    + '</div>';
                return button;
            }else{
                return "";
            }
        }
    });
</script>
</html>